import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:video_player/video_player.dart';
import 'package:marquee_flutter/marquee_flutter.dart';
import 'package:wanchong/widget/ConnectWidget.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:wanchong/widget/chewie_paly_item.dart';

//import 'package:flukit/flukit.dart';
class Vid extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _VideoState();
  }
}

class _VideoState extends State<Vid> {
  bool playshow = false;
  int palyItem = 0;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        child: Swiper(
          itemBuilder: (BuildContext context, int index) {
            return Container(
              child: Stack(
                children: <Widget>[
                  Center(
                    child: ChewieListItem(
                      url:
                          'http://zhmc.yyang.xin/4782700501b4aa98a4b2c4dd57b8056b.mp4',
                      autoPlay: true,
                    ),
                  ),
                  Positioned(
                    right: ScreenUtil.getInstance().setSp(15.0),
                    top: ScreenUtil.getInstance().setSp(40.0),
                    child: Container(
                      width: ScreenUtil.getInstance().setSp(30.0),
                      height: ScreenUtil.getInstance().setSp(30.0),
                      child: GestureDetector(
                        onTap: () {
                          Navigator.pop(context);
                        },
                        child: CircleAvatar(
                          backgroundColor: Color(0x00000000),
                          backgroundImage: new AssetImage(
                              'assets/livevideo/equipment_saomiao_top_close_icon.png'),
                          radius: ScreenUtil.getInstance().setSp(30.0),
                        ),
                      ),
                    ),
                  ),
                  Positioned(
                    left: ScreenUtil.getInstance().setSp(15.0),
                    top: ScreenUtil.getInstance().setSp(30.0),
                    child: Container(
                      child: Row(
                        children: <Widget>[
                          Container(
                            width: ScreenUtil.getInstance().setSp(50.0),
                            height: ScreenUtil.getInstance().setSp(50.0),
                            child: CircleAvatar(
                              backgroundImage: new NetworkImage(
                                  'http://pic37.nipic.com/20140113/8800276_184927469000_2.png'),
                              radius: ScreenUtil.getInstance().setSp(50.0),
                            ),
                          ),
                          Container(
                            margin: EdgeInsets.only(
                                left: ScreenUtil.getInstance().setSp(5.0)),
                            child: Text(
                              '我是谁我在那',
                              style: TextStyle(
                                color: Colors.white,
                                fontSize: ScreenUtil.getInstance().setSp(18.0),
                                fontWeight: FontWeight.w700,
                              ),
                            ),
                          ),
                        ],
                      ),
                    ),
                  ),
                  Positioned(
                    bottom: ScreenUtil.getInstance().setSp(150.0),
                    left: ScreenUtil.getInstance().setSp(15.0),
                    child: Container(
                      height: ScreenUtil.getInstance().setSp(30.0),
                      width: ScreenUtil.getInstance().setSp(125.0),
                      alignment: Alignment.center,
                      margin: EdgeInsets.only(left: 0.0),
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(
                            ScreenUtil.getInstance().setSp(30.0)),
                        color: Color(0xFFFFCC33),
                      ),
                      child: new MarqueeWidget(
                        text: "我是谁我在那我是谁我在那",
                        textStyle: new TextStyle(
                            fontSize: ScreenUtil.getInstance().setSp(15.0),
                            color: Color(0xFF111111)),
                        scrollAxis: Axis.horizontal,
                      ),
                    ),
                  ),
                  Positioned(
                    bottom: ScreenUtil.getInstance().setSp(80.0),
                    left: ScreenUtil.getInstance().setSp(15.0),
                    child: Container(
                      height: ScreenUtil.getInstance().setSp(50.0),
                      width: ScreenUtil.getInstance().setSp(250.0),
                      child: Text(
                        '我是谁我在那我是谁我在那我是谁我在那我是谁我在那我是谁我在那',
                        textAlign: TextAlign.left,
                        maxLines: 2,
                        overflow: TextOverflow.ellipsis,
                        style: TextStyle(
                          fontSize: ScreenUtil.getInstance().setSp(15.0),
                          color: Colors.white,
                        ),
                      ),
                    ),
                  ),
                  Positioned(
                    bottom: ScreenUtil.getInstance().setSp(100.0),
                    right: ScreenUtil.getInstance().setSp(15.0),
                    child: Container(
                      width: ScreenUtil.getInstance().setSp(30.0),
                      height: ScreenUtil.getInstance().setSp(30.0),
                      child: Image.asset(
                        'assets/livevideo/home_icon_dianzan_a.png',
                        width: ScreenUtil.getInstance().setSp(30.0),
                        height: ScreenUtil.getInstance().setSp(30.0),
                        fit: BoxFit.cover,
                      ),
                    ),
                  ),
                  Positioned(
                    bottom: ScreenUtil.getInstance().setSp(30.0),
                    right: ScreenUtil.getInstance().setSp(15.0),
                    child: Container(
                      width: ScreenUtil.getInstance().setSp(30.0),
                      height: ScreenUtil.getInstance().setSp(30.0),
                      child: Image.asset(
                        'assets/livevideo/home_icon_gengduo.png',
                        width: ScreenUtil.getInstance().setSp(30.0),
                        height: ScreenUtil.getInstance().setSp(30.0),
                        fit: BoxFit.cover,
                      ),
                    ),
                  ),
                  Positioned(
                    bottom: ScreenUtil.getInstance().setSp(30.0),
                    left: ScreenUtil.getInstance().setSp(15.0),
                    child: Container(
                      alignment: Alignment.centerLeft,
                      width: ScreenUtil.getInstance().setSp(300.0),
                      height: ScreenUtil.getInstance().setSp(30.0),
                      child: Text(
                        '1020  阅读量      300 个赞',
                        style: TextStyle(
                          color: Color(0xFFB4BEC6),
                          fontSize: ScreenUtil.getInstance().setSp(12.0),
                        ),
                      ),
                    ),
                  ),
                ],
              ),
            );
          },
          itemCount: 5,
          scrollDirection: Axis.vertical,
          loop: false,
          onIndexChanged: (index) {
            setState(() {
              palyItem = index;
            });
          },
        ),
        color: Color(0XFF000000),
      ),
    );
  }

  void dispose() {
    super.dispose();
  }
}
